<?php 
    $this->model = new Areas_Gallery_Models_Gallery();
?>
<?php $this->section->begin('breadcrumb')?>
<div id="global-breadcrumb">
	<ul>
		<li><a href="<?php echo $this->url->action("index", "ControlPanel", "Gallery")?>">Thư viên ảnh</a></li>
		<li class="current">Thêm thư viện ảnh</li>
	</ul>
</div>
<?php $this->section->end()?>
<?php $this->content->begin()?>
<div class="widget-shell inner-shadow">
	<div class="widget-header">
		<h2>Thêm thư viện ảnh</h2>
	</div>
	<div class="widget-body">
		<?php
		    $ajaxOption['begin'] = "begin";
		    $ajaxOption['success'] = "success";
		    $this->form->beginAjax($ajaxOption, 'Edit');
		?>
			<div class="global-form">
				<div class="fclear"></div>
				<div class="half margin-bottom-20">
					<?php $this->form->labelFor("name", array('class' => 'normal-label'))?>
					<?php $this->form->textboxFor("name", array('class' => 'normal'))?>
					<?php $this->form->validationMessage("name")?>
				</div>
				<div class="fclear"></div>
				<div class="half margin-bottom-20">
					<?php $this->form->labelFor("description", array('class' => 'normal-label'))?>
					<?php $this->form->textareaFor("description", array('class' => 'normal markItUpEditor'))?>
				</div>
				<div class="fclear"></div>
				<div class="half margin-bottom-20">
					<?php $this->form->labelFor("image", array('class' => 'normal-label'))?>
					<?php $this->form->textboxFor("image", array('class' => 'normal'))?>
					<a href="javascript:void(0)" class="button" onclick="openImageManager('image')">
							<span class="ico-text ico-text-pic"></span>Quản lý ảnh
					</a>
				</div>
				<div class="fclear"></div>
			</div>
			<div class="alert alert-info alert-loading" style="margin-bottom: 0; display: none;">
				<p><span class="ico-text ico-alert-loading"></span><span>Đang thêm thư viện ảnh mới vào hệ thống...</span></p>
			</div>
			<div class="alert alert-error" style="margin-bottom: 0; display: none;">
				<p><span class="ico-text ico-alert-error"></span><span id="errorMessage"></span></p>
			</div>
			<div class="alert alert-success" style="margin-bottom: 0; display: none;">
				<p><span class="ico-text ico-alert-success"></span><span id="successMessage"></span></p>
			</div>
			<div class="global-form-footer">
				<input class="btn-theme" id="submit" type="submit" value="Thêm mới">
				<input id="reset" type="reset" value="Xóa trắng">
				<a href="<?php echo $this->url->action("index")?>" class="button">
    				<span class="ico-text ico-text-category"></span>Thư viện ảnh
    			</a>
			</div>
		<?php $this->form->end()?>
	</div>
</div>
<?php $this->content->end()?>
<?php $this->section->begin("scripts")?>
<?php 
//Load js
$this->html->loadJs(array(
                        'Scripts/jquery.validate.min.js',
                        'Scripts/jquery.validate.unobtrusive.min.js',
                        'Scripts/jquery.unobtrusive-ajax.min.js',
                        'Areas/ControlPanel/Assets/js/controlpanel.js',
                        'Assets/tiny_mce/tiny_mce.js',
                        'Assets/tiny_mce/plugins/imagemanager/js/mcimagemanager.js'
                    ));
?>
<script type="text/javascript">
 function openImageManager(element)
 {
	 mcImageManager.open('Edit', element);
 }
</script>
<?php $this->section->end()?>